<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {

    public function _initMessages() {

        $messagesFileName = $this->getOption('messages');
        Zend_Registry::set(VirtualLabs_Common::DEFAULT_MESSAGES, new Zend_Config_Ini($messagesFileName, "default"));
        Zend_Registry::set(VirtualLabs_Common::ERROR_MESSAGES, new Zend_Config_Ini($messagesFileName, "error"));
        Zend_Registry::set(VirtualLabs_Common::WARNING_MESSAGES, new Zend_Config_Ini($messagesFileName, "warning"));
        Zend_Registry::set(VirtualLabs_Common::SUCCESS_MESSAGES, new Zend_Config_Ini($messagesFileName, "success"));
        Zend_Registry::set(VirtualLabs_Common::HELP_MESSAGES, new Zend_Config_Ini($messagesFileName, "help"));
    }

    public function _initLog() {
        $writerError = new Zend_Log_Writer_Stream($this->getOption('error_log'));
        $writerDebug = new Zend_Log_Writer_Stream($this->getOption('debug_log'));
        $writerInfo = new Zend_Log_Writer_Stream($this->getOption('info_log'));
        $logError = new Zend_Log($writerError);
//        $logError->log('Error log created', Zend_Log::INFO);
        Zend_Registry::set(VirtualLabs_Exception::ERROR_LOG, $logError);
        $logDebug = new Zend_Log($writerDebug);
//        $logDebug->log('Debug log created', Zend_Log::INFO);
        Zend_Registry::set(VirtualLabs_Common::DEBUG_LOG, $logDebug);
        $logInfo = new Zend_Log($writerInfo);
//        $logInfo->log('Info log created', Zend_Log::INFO);
        Zend_Registry::set(VirtualLabs_Common::INFO_LOG, $logInfo);
    }

}

